<!--  -->
<template>
  <div class="box">
    <el-table :data="tableData" style="width: 100%" max-height="100%">
      <el-table-column fixed prop="id" label="ID" width="200">
      </el-table-column>
      <!-- <el-table-column
      fixed="right"
      label="图片"
      width="120">
      <template slot-scope="scope">
        {{scope}} 
      </template>
    </el-table-column> -->
    <!-- 1 -->
      <el-table-column prop="img" label="砍价图片" > </el-table-column>
      <el-table-column prop="name" label="砍价商品名称" > </el-table-column>
      <el-table-column prop="" label="省份" >
      </el-table-column>
      <el-table-column prop="city" label="市区" > </el-table-column>
      <el-table-column prop="address" label="地址">
      </el-table-column>
      <el-table-column prop="zip" label="邮编"> </el-table-column>
      <el-table-column fixed="right" label="操作">
        <template slot-scope="scope">
          <el-button type="text" size="small">编辑</el-button>
          <el-button
            @click.native.prevent="deleteRow(scope.$index, tableData)"
            type="text"
            size="small"
          >
            移除
          </el-button>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
import { apiGetKshop } from "../../../../api/Kshop.js";
export default {
  //import引入的组件需要注入到对象中才能使用
  components: {},
  data() {
    //这里存放数据
    return {
      tableData: []
    };
  },
  //监听属性 类似于data概念
  computed: {},
  //监控data中的数据变化
  watch: {},
  //方法集合
  methods: {
    deleteRow(index, rows) {
      rows.splice(index, 1);
    }
  },
  //生命周期 - 创建完成（可以访问当前this实例）
  async created() {
    const res = await apiGetKshop();
    console.log("res", res);
    this.tableData=res.list
  },
  //生命周期 - 挂载完成（可以访问DOM元素）
  mounted() {}
};
</script>
<style lang="scss" scoped></style>
